From f578bafffd551b29ca44962d9f1628d04890db72 Mon Sep 17 00:00:00 2001 From: "emellor@ewan" Date: Sun, 2 Oct 2005 18:17:26 +0100 Subject: [PATCH] Fix call to XendCheckpoint.restore, since that method no longer needs a XendDomain instance passed in. Remove meaningless indirection of imports through web/reactor.py. Tidy import statements. Signed-off-by: Ewan Mellor --- tools/python/xen/web/reactor.py | 19 ------------------- tools/python/xen/xend/server/event.py | 16 +++++++++++----- tools/python/xen/xend/server/relocate.py | 19 ++++++++++++------- 3 files changed, 23 insertions(+), 31 deletions(-) delete mode 100644 tools/python/xen/web/reactor.py diff --git a/tools/python/xen/web/reactor.py b/tools/python/xen/web/reactor.py deleted file mode 100644 index 2be9126988..0000000000 --- a/tools/python/xen/web/reactor.py +++ /dev/null @@ -1,19 +0,0 @@ -#============================================================================ -# This library is free software; you can redistribute it and/or -# modify it under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -#============================================================================ -# Copyright (C) 2005 Mike Wray -#============================================================================ - -from unix import listenUNIX, connectUNIX -from tcp import listenTCP, connectTCP, SetCloExec diff --git a/tools/python/xen/xend/server/event.py b/tools/python/xen/xend/server/event.py index d5b54c7053..d8a03a521f 100644 --- a/tools/python/xen/xend/server/event.py +++ b/tools/python/xen/xend/server/event.py @@ -13,19 +13,25 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #============================================================================ # Copyright (C) 2004, 2005 Mike Wray +# Copyright (C) 2005 XenSource Ltd #============================================================================ import sys import StringIO -from xen.web import reactor, protocol +from xen.web import protocol, tcp, unix from xen.xend import scheduler from xen.xend import sxp from xen.xend import PrettyPrint -from xen.xend import EventServer; eserver = EventServer.instance() +from xen.xend import EventServer from xen.xend.XendError import XendError -from xen.xend import XendRoot; xroot = XendRoot.instance() +from xen.xend import XendRoot + + +eserver = EventServer.instance() +xroot = XendRoot.instance() + DEBUG = 0 @@ -210,8 +216,8 @@ def listenEvent(daemon): factory = EventFactory(daemon) if xroot.get_xend_unix_server(): path = '/var/lib/xend/event-socket' - reactor.listenUNIX(path, factory) + unix.listenUNIX(path, factory) if xroot.get_xend_http_server(): port = xroot.get_xend_event_port() interface = xroot.get_xend_address() - reactor.listenTCP(port, factory, interface=interface) + tcp.listenTCP(port, factory, interface=interface) diff --git a/tools/python/xen/xend/server/relocate.py b/tools/python/xen/xend/server/relocate.py index b8959baa06..610c459af2 100644 --- a/tools/python/xen/xend/server/relocate.py +++ b/tools/python/xen/xend/server/relocate.py @@ -13,22 +13,28 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #============================================================================ # Copyright (C) 2004, 2005 Mike Wray +# Copyright (C) 2005 XenSource Ltd #============================================================================ import socket import sys import StringIO -from xen.web import reactor, protocol +from xen.web import protocol, tcp, unix from xen.xend import scheduler from xen.xend import sxp -from xen.xend import EventServer; eserver = EventServer.instance() +from xen.xend import EventServer from xen.xend.XendError import XendError -from xen.xend import XendRoot; xroot = XendRoot.instance() +from xen.xend import XendRoot from xen.xend.XendLogging import log from xen.xend import XendCheckpoint + +eserver = EventServer.instance() +xroot = XendRoot.instance() + + DEBUG = 0 class RelocationProtocol(protocol.Protocol): @@ -114,8 +120,7 @@ class RelocationProtocol(protocol.Protocol): if self.transport: self.send_reply(["ready", name]) self.transport.sock.setblocking(1) - xd = xroot.get_component("xen.xend.XendDomain") - XendCheckpoint.restore(xd, self.transport.sock.fileno()) + XendCheckpoint.restore(self.transport.sock.fileno()) self.transport.sock.setblocking(0) else: log.error(name + ": no transport") @@ -136,11 +141,11 @@ def listenRelocation(): factory = RelocationFactory() if xroot.get_xend_unix_server(): path = '/var/lib/xend/relocation-socket' - reactor.listenUNIX(path, factory) + unix.listenUNIX(path, factory) if xroot.get_xend_relocation_server(): port = xroot.get_xend_relocation_port() interface = xroot.get_xend_relocation_address() - l = reactor.listenTCP(port, factory, interface=interface) + l = tcp.listenTCP(port, factory, interface=interface) l.setCloExec() def setupRelocation(dst, port): -- 2.30.2